<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


require_once 'CIS_Messages.php';

class CIS_Loader extends CI_Loader
{
    protected $messages;
    protected $layout;
    protected $pageTitle;
    protected $moduleName;
    
    function __construct() 
    {
            parent::__construct();
            $this->messages = new CIS_Messages();
    }
    
    
    public function module_model($model, $name = '', $db_conn = FALSE) {
            $model_suffix = '_model';
            $model_with_suffix = $model . $model_suffix;
            $module_directory = 'modules/';
            $default_model = 'Model';
            
            //check if model exists
            if(file_exists(strtolower(APPPATH . 'models/' . $module_directory . $model_with_suffix . EXT))) {
                    $new_name = ($name == '') ? 'Model' : $name;
                    parent::model($module_directory . $model_with_suffix, $new_name, $db_conn);
            }
    }
    
}